package generator.test.examples.fibonacci;

import java.io.Serializable;


@SuppressWarnings("serial")
public class Fibonacci implements Serializable{

	private FibonacciIF fibDependency = null;


	public FibonacciIF getFibDependency() {
		return fibDependency;
	}

	public void setFibDependency(FibonacciIF selfdependency) {
		this.fibDependency = selfdependency;
	}

	public long fib(int n) {
		if (n < 2)
			return n;
		long x = this.getFibDependency().fib(n - 1);
		long y = this.getFibDependency().fib(n - 2);
		return x + y;
	}

	public void run(){
		int n = 45;
		long result = this.getFibDependency().fib(n);
		System.out.println("Fibonnaci (" + n + ") = " + result);
		System.out.println("(Parallel TestMFGS) Execution finished.");
	}

}
